/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Colaboradores;

import java.util.Iterator;
import javax.faces.component.UIComponent;

/**
 *
 * @author James
 */
public class GestionComponentesFaces {

    public UIComponent findComponent(UIComponent parent, String id) {
        if (id.equals(parent.getId())) {
            return parent;
        }
        Iterator<UIComponent> kids = parent.getFacetsAndChildren();
        while (kids.hasNext()) {
            UIComponent kid = kids.next();
            UIComponent found = findComponent(kid, id);
            if (found != null) {
                return found;
            }
        }
        return null;
    }
}
